﻿@model IEnumerable<NuGet.IPackage>
@{
    ViewBag.Title = "Index";
}
<h2>Index</h2>

<ol id="searchResults">
    @foreach (var package in Model)
    {
        <li>
            <section class="package">
                <div class="side">
                    <a href="@package.ProjectUrl" title="View more about @package.Id">
                        @if (package.IconUrl != null)
                        {
                            <img src="@package.IconUrl" alt="@package.Id icon" />
                        }
                        else
                        {
                            <img src="@Url.Content("~/Content/Images/packageDefaultIcon-50x50.png")" alt="@package.Id icon" />
                        }
                    </a>
                </div>
                <div class="main">
                    <header>
                        <h1><a href="@package.ProjectUrl">@package.Id</a></h1>
                        @if (package.Owners != null)
                        {
                            <h2>By:</h2>
                            <ul class="owners">
                                @foreach (var owner in package.Owners)
                                {
                                    <li>
                                        <span>@owner</span>
                                    </li>
                                }
                            </ul>
                        }
                    </header>
                    
                    <p>
                    @package.Description
                    </p>

                    <div>
                        @if (!string.IsNullOrWhiteSpace(package.Tags))
                        {
                            <div class="tags">
                                <h2>Tags</h2>
                                <ul class="tags">
                                    @foreach (var tag in package.Tags.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
                                    {
                                        <li>
                                            <a href="@Url.Content("~/Admin/package?q=" + tag)" title="Search for @tag">@tag</a>
                                        </li>
                                    }
                                </ul>
                            </div>
                        }
                    </div>
                </div>
            </section>
        </li>
    }
</ol>
